package com.wyb.controller;


import com.wyb.constant.Result;
import com.wyb.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 消息表 前端控制器
 * </p>
 *
 * @author wyb
 * @since 2023-02-26
 */
@RestController
@RequestMapping("/message")
public class MessageController {

    @Autowired
    private MessageService messageService;

    //    根据userId获取消息
    @GetMapping("/getmessage")
    public Result getMessage(@RequestParam int userId){
        return messageService.getMessage(userId);
    }

    //    根据消息id删除消息
    @DeleteMapping("deletemessage")
    public Result deleteMessage(@RequestParam int id){
       return messageService.deleteMessage(id);
    }
    //    根据userId删除全部消息
    @DeleteMapping("deletemessages")
    public Result deleteMessages(@RequestParam int userId){
       return messageService.deleteMessages(userId);
    }
}

